package nio;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;

public class TransferFrom {
    public static void main(String[] args) throws IOException {
        RandomAccessFile fromFile = new RandomAccessFile("from.txt", "rw");
        RandomAccessFile toFile = new RandomAccessFile("to.txt", "rw");
        FileChannel fromChannel = fromFile.getChannel();
        FileChannel toChannel = toFile.getChannel();

        toChannel.transferFrom(fromChannel,0, fromChannel.size());


    }
}
